using Coding4Fun.Phone.Controls;
using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Plugin.MassSend;
using MicroMsg.Plugin.MassSend.Scene;
using MicroMsg.Protocol;
using MicroMsg.Resource.@string;
using MicroMsg.Storage;
using MicroMsg.UI.ImageFilter;
using MicroMsg.UI.UserContrl;
using MicroMsg.UI.Util;
using Microsoft.Phone.Tasks;
using Microsoft.Xna.Framework.Media;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace MicroMsg.UI.Page
{
	public class SendMessagePage : BasePage
	{
		private const string TAG = "SendMessagePage";
		private const int OldListHeight = 604;
		private const int OldSmileyHeight = 342;
		private bool bIsSendAgain;
		private string listDisplayName;
		private string listUserName;
		private uint listCount;
		private string strContent;
		private bool mIsDelaySendMsg;
		private bool isFromShareContent;
		private string strShareContentToken = "";
		private EventWatcher mMassSendWatcher;
		public EmojiListCtrl mEmojiListCtrl;
		private ChatInputMode mCuInputMode;
		private bool mIsDelayShowSmiley;
		private double mSipHeight;
		private EventWatcher mPicSendingWatcher;
		private EventWatcher mPicSendCompleteWatcher;
		private Dictionary<int, int> ProgressDic;
		private bool hasCoverInfront;
		private RoundButton ExtraActionBtn;
		private bool mBIsInputerInited;
		private bool isInputFocus;
		private bool isVoiceRecordStart;
		private bool mBIsExtraActionCancled;
		internal Grid LayoutRoot;
		internal Grid MassSendTitle;
		internal StackPanel TitleArea;
		internal EmojiText PageTitle;
		internal Grid ChatPanelRoot;
		internal Grid ChatList;
		internal SendMsgViewCtrl sendPeopleCtrl;
		internal StackPanel FootArea;
		internal MMInputer mInputer;
		internal ExtralChatButton mExtralChatButton;
		private bool _contentLoaded;
		public bool IsEmojiListCtrlExist
		{
			get
			{
				return this.mEmojiListCtrl != null;
			}
		}
		public SendMessagePage()
		{
			this.InitializeComponent();
			base.add_Loaded(new RoutedEventHandler(this.SendMessagePage_Loaded));
			base.add_Unloaded(new RoutedEventHandler(this.SendMessagePage_Unloaded));
		}
		private void SendMessagePage_Loaded(object sender, RoutedEventArgs e)
		{
			this.InitWatcher();
			this.mExtralChatButton.CameraButtonClick += new RoutedEventHandler(this.mExtralChatButton_CameraCardClick);
			this.mExtralChatButton.PicButtonClick += new RoutedEventHandler(this.mExtralChatButton_PicButtonClick);
			this.mExtralChatButton.ShareCardClick += new RoutedEventHandler(this.mExtralChatButton_ShareCardClick);
			this.mExtralChatButton.ShareLocationButtonClick += new RoutedEventHandler(this.mExtralChatButton_ShareLocationButtonClick);
		}
		private void inputTxt_Tap(object sender, GestureEventArgs e)
		{
			this.SwitchMode(ChatInputMode.InputTxtMode, false);
			Log.smethod_5("SendMessagePage", "inputTxt_Tap:");
		}
		private void SendMessagePage_Unloaded(object sender, RoutedEventArgs e)
		{
			this.UnitWatcher();
		}
		protected override void OnPageIn(object[] object_0)
		{
			Log.smethod_5("SendMessagePage", "SendMessagePage Pagein");
			this.PageTitle.Foreground = R.theme.CHAT_TITLE_BRUSH;
			this.LayoutRoot.set_Background(R.theme.CHAT_BK_BRUSH);
			if (object_0 != null && object_0.Length > 0)
			{
				this.listUserName = (string)object_0[0];
				this.listCount = (uint)object_0[1];
				this.bIsSendAgain = (bool)object_0[2];
				this.InitUI();
				if (object_0.Length == 4)
				{
					this.isFromShareContent = true;
					this.strShareContentToken = (object_0[3] as string);
				}
			}
			base.BeginListenForSIPChanged();
			this.SendPicInit();
			if (this.isFromShareContent)
			{
				this.AutoMassSendImg(this.strShareContentToken);
			}
			this.initInputer();
		}
		protected override void OnPageOut()
		{
			this.SendPicUnit();
		}
		protected override void OnBackKeyPress(CancelEventArgs cancelEventArgs_0)
		{
			if (this.mEmojiListCtrl != null && this.mEmojiListCtrl.get_Visibility() == null)
			{
				base.get_Dispatcher().BeginInvoke(delegate
				{
					this.SwitchMode(ChatInputMode.InputSmileyMode, false);
					this.mEmojiListCtrl.set_Visibility(1);
				});
				cancelEventArgs_0.set_Cancel(true);
				return;
			}
			MassSend.getInstance().mSceneMassSend.cancel();
			base.OnBackKeyPress(cancelEventArgs_0);
		}
		public void CheckEmojiListCtrl()
		{
			if (this.mEmojiListCtrl != null)
			{
				return;
			}
			this.mEmojiListCtrl = new EmojiListCtrl();
			this.mEmojiListCtrl.set_Margin(new Thickness(0.0, 0.0, 0.0, 0.0));
			this.LayoutRoot.get_Children().Add(this.mEmojiListCtrl);
		}
		private void InitUI()
		{
			if (!string.IsNullOrEmpty(this.listUserName) && this.listCount != 0u)
			{
				this.listDisplayName = "";
				string text = strings.MassSend_WriteMessage_SendTo;
				text = text.Replace("%u", this.listCount.ToString());
				if (this.listCount == 1u && R.isEnglish())
				{
					text = text.Replace("friends", "friend");
				}
				this.sendPeopleCtrl.strTitle = text;
				string[] array = this.listUserName.Split(new char[]
				{
					';'
				});
				for (int i = 0; i < Enumerable.Count<string>(array) - 1; i++)
				{
					this.listDisplayName += ContactHelper.getDisplayName(array[i], null);
					this.listDisplayName += ", ";
				}
				this.listDisplayName += ContactHelper.getDisplayName(array[Enumerable.Count<string>(array) - 1], null);
				this.sendPeopleCtrl.strListContent = this.listDisplayName;
				return;
			}
		}
		private void InitWatcher()
		{
			if (this.mMassSendWatcher == null)
			{
				this.mMassSendWatcher = new EventWatcher(this, null, new EventHandlerDelegate(this.onEventHandlerMassSend));
				EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_MASS_SEND_ERR, this.mMassSendWatcher);
				EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_MASS_SEND_SUCCESS, this.mMassSendWatcher);
			}
		}
		private void UnitWatcher()
		{
			if (this.mMassSendWatcher != null)
			{
				EventCenter.removeEventWatcher(EventConst.ON_NETSCENE_MASS_SEND_ERR, this.mMassSendWatcher);
				EventCenter.removeEventWatcher(EventConst.ON_NETSCENE_MASS_SEND_SUCCESS, this.mMassSendWatcher);
				this.mMassSendWatcher = null;
			}
		}
		private void ShowVoiceError()
		{
			MessageBoxManager.ShowToast(strings.ChatVoiceSendTooShort, 2500, null, false);
		}
		private void ShowVoiceTooLong()
		{
			MessageBoxManager.ShowToast(strings.ChatVoiceSendTooLong, 2500, null, false);
		}
		private void onEventHandlerMassSend(EventWatcher watcher, BaseEventArgs evtArgs)
		{
			this.hideProgressCover();
			if (evtArgs == null)
			{
				return;
			}
			if (evtArgs.mEventID != EventConst.ON_NETSCENE_MASS_SEND_SUCCESS)
			{
				if (evtArgs.mEventID == EventConst.ON_NETSCENE_MASS_SEND_ERR)
				{
					this.hideProgressCover();
					NetSceneMassSend.NetSceneMassSendResult netSceneMassSendResult = evtArgs.mObject as NetSceneMassSend.NetSceneMassSendResult;
					if (netSceneMassSendResult.isVoiceTooShort)
					{
						this.ShowVoiceError();
						return;
					}
					if (netSceneMassSendResult.retCode == RetConst.MM_ERR_TOLIST_LIMITED)
					{
						MMMessageBox.Show(strings.MassSend_WriteMessage_SendErrTooManMassSend_WriteMessage_SendErrTooMany, true, "确定");
						return;
					}
					if (netSceneMassSendResult.retCode == RetConst.MM_ERR_FREQ_LIMITED)
					{
						MMMessageBox.Show(strings.MassSend_WriteMessage_SendErrFreq, true, "确定");
						return;
					}
					if (netSceneMassSendResult.retCode == RetConst.MM_ERR_SPAM)
					{
						MMMessageBox.Show(strings.MassSend_WriteMessage_SendErrSpam, true, "确定");
						return;
					}
					MMMessageBox.Show(strings.ChatValidError, true, "确定");
				}
				return;
			}
			if (this.isFromShareContent)
			{
				base.GoToPage("/Source/Plugin/MassSend/UI/MessagesListPage.xaml", null, true);
				return;
			}
			base.get_Dispatcher().BeginInvoke(delegate
			{
				base.GoBack();
			});
		}
		private void successToast_Completed(object sender, PopUpEventArgs<string, PopUpResult> e)
		{
			base.GoBack();
		}
		private void ExtraActionBtn_MouseLeave(object sender, MouseEventArgs e)
		{
			if (!this.IsSipOpen())
			{
				return;
			}
			Log.smethod_5("SendMessagePage", "ExtraActionBtn_MouseLeave");
			this.mExtralChatButton.Switch();
		}
		private void FireSendTxt()
		{
			if (MassSend.getInstance().mSceneMassSend.doSceneSendText(this.listUserName, this.listCount, this.bIsSendAgain, this.strContent))
			{
				this.showProgressCover(strings.MassSend_WriteMessage_Sending);
				return;
			}
			MMMessageBox.Show(strings.ChatValidError, true, "确定");
		}
		private void DoSend(string strInput, bool isSmiley = false)
		{
			if (strInput == null || strInput.get_Length() == 0)
			{
				MessageBoxManager.ShowToast(strings.ChatEmptyTxtHint, 2500, null, false);
				return;
			}
			bool flag = false;
			bool flag2 = false;
			string sbStr = EmojiManager.GetInstance().ConvertInputStrToCodeStr(strInput, ref flag);
			sbStr = EmojiManager.GetInstance().SbCodeToUtf16Code(sbStr, ref flag2);
			if (!isSmiley)
			{
				this.mIsDelaySendMsg = true;
				this.strContent = sbStr;
				return;
			}
			if (MassSend.getInstance().mSceneMassSend.doSceneSendText(this.listUserName, this.listCount, this.bIsSendAgain, sbStr))
			{
				this.showProgressCover(strings.MassSend_WriteMessage_Sending);
				return;
			}
			MMMessageBox.Show(strings.ChatValidError, true, "确定");
		}
		public void SwitchMode(ChatInputMode mode, bool bNotFoucsTxt = false)
		{
			this.mExtralChatButton.Hide();
			if (this.mCuInputMode == mode)
			{
				return;
			}
			this.mCuInputMode = mode;
			if (this.mCuInputMode != this.mInputer.GetMode())
			{
				this.mInputer.SwitchMode(mode, bNotFoucsTxt);
			}
			switch (mode)
			{
			case ChatInputMode.InputDefault:
				base.Focus();
				break;
			}
			this.RefreshChatListLayoutForSip();
		}
		private void RefreshChatListLayoutForSip()
		{
			this.ChatPanelRoot.UpdateLayout();
		}
		private bool IsSipOpen()
		{
			return this.mSipHeight > 0.001;
		}
		protected override void RootFrameChange(double double_0)
		{
			this.mSipHeight = double_0;
		}
		private void ChatList_Tap(object sender, GestureEventArgs e)
		{
			this.mExtralChatButton.Hide();
			this.SwitchMode(ChatInputMode.InputDefault, false);
		}
		public void EmojiSelectComplete(string EmojiStr)
		{
			if (string.IsNullOrEmpty(EmojiStr))
			{
				return;
			}
			if (MassSend.getInstance().mSceneMassSend.doSceneSendText(this.listUserName, this.listCount, this.bIsSendAgain, EmojiStr))
			{
				this.showProgressCover(strings.MassSend_WriteMessage_Sending);
				return;
			}
			MMMessageBox.Show(strings.ChatValidError, true, "确定");
		}
		public int GetPicProgress(int msgLocalId)
		{
			if (this.ProgressDic == null)
			{
				return -1;
			}
			if (!this.ProgressDic.ContainsKey(msgLocalId))
			{
				return 0;
			}
			return this.ProgressDic.get_Item(msgLocalId);
		}
		private void SetPicProgress(int msgLocalId, int int_0)
		{
			if (this.ProgressDic == null)
			{
				return;
			}
			this.ProgressDic.set_Item(msgLocalId, int_0);
		}
		private void SendPicInit()
		{
			this.ProgressDic = new Dictionary<int, int>();
			this.mPicSendingWatcher = new EventWatcher(this, this, new EventHandlerDelegate(this.onPicSendingEventHandler));
			EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_SENDIMG_PROGRESS, this.mPicSendingWatcher);
			this.mPicSendCompleteWatcher = new EventWatcher(this, this, new EventHandlerDelegate(this.onPicSendCompleteEventHandler));
			EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_SENDIMG_COMPLETE, this.mPicSendCompleteWatcher);
		}
		private void SendPicUnit()
		{
			if (this.ProgressDic != null)
			{
				this.ProgressDic.Clear();
			}
			this.ProgressDic = null;
			EventCenter.removeEventWatcher(EventConst.ON_NETSCENE_SENDIMG_PROGRESS, this.mPicSendingWatcher);
			EventCenter.removeEventWatcher(EventConst.ON_NETSCENE_SENDIMG_COMPLETE, this.mPicSendCompleteWatcher);
		}
		private void onPicSendingEventHandler(EventWatcher watcher, BaseEventArgs evtArgs)
		{
			if (evtArgs == null)
			{
				return;
			}
		}
		private void onPicSendCompleteEventHandler(EventWatcher watcher, BaseEventArgs evtArgs)
		{
			if (evtArgs == null)
			{
				return;
			}
		}
		private void UpdateImageProgressByLocalId(int localId, int progress)
		{
		}
		private void ChooserPicture()
		{
			ToolFunction.GotoPageForUserControl("/Source/UI/ImageFilter/ImageFilterPage.xaml", new object[]
			{
				new ImageFilterConfig(new ImageFilterCallBack(this.PhotoChooserTaskCompleted), ImageFilterGetPicMode.GetPicMode_Choose_With_Take, 0, 0, null)
				{
					GetPicMode = ImageFilterGetPicMode.GetPicMode_Choose_Exist,
					RawImageHandleCallBack = new RawImageHandleCallBack(this.PhotoChooserTaskRawImageCompleted)
				}
			}, false);
		}
		private void TakePhoto()
		{
			ToolFunction.GotoPageForUserControl("/Source/UI/ImageFilter/ImageFilterPage.xaml", new object[]
			{
				new ImageFilterConfig(new ImageFilterCallBack(this.photoCameraCapture_Completed), ImageFilterGetPicMode.GetPicMode_Choose_With_Take, 0, 0, null)
				{
					GetPicMode = ImageFilterGetPicMode.GetPicMode_Take_Photo,
					isSaveToAlbum = ImageFilterMgr.IsSettingAutoSavePhotos(),
					RawImageHandleCallBack = new RawImageHandleCallBack(this.photoCameraCaptureRawImage_Completed)
				}
			}, false);
		}
		private void photoCameraCapture_Completed(Stream resultData)
		{
			if (resultData != null)
			{
				Log.smethod_5("SendMessagePage", "photoCameraCapture_Completed");
				this.ImageConfirmOk(resultData, true);
			}
		}
		private void photoCameraCaptureRawImage_Completed(Stream resultData)
		{
			if (resultData != null)
			{
				Log.smethod_5("SendMessagePage", "photoCameraCaptureRawImage_Completed");
				this.ImageConfirmOk(resultData, false);
			}
		}
		private void PhotoChooserTaskCompleted(Stream resultData)
		{
			if (resultData != null)
			{
				Log.smethod_5("SendMessagePage", "PhotoChooserTaskCompleted");
				this.ImageConfirmOk(resultData, true);
			}
		}
		private void PhotoChooserTaskRawImageCompleted(Stream resultData)
		{
			if (resultData != null)
			{
				Log.smethod_5("SendMessagePage", "PhotoChooserTaskRawImageCompleted");
				this.ImageConfirmOk(resultData, false);
			}
		}
		public void ImageConfirmOk(Stream imgStream, bool isNeedScale = true)
		{
			imgStream.set_Position(0L);
			byte[] array = new byte[100];
			imgStream.Read(array, 0, 100);
			ImageFromat imageFormat = ImageUtil.getImageFormat(array);
			imgStream.set_Position(0L);
			Log.smethod_5("SendMessagePage", "image format = " + imageFormat.ToString());
			if (imageFormat != ImageFromat.jpeg)
			{
				if (imageFormat != ImageFromat.const_2)
				{
					Log.smethod_1("SendMessagePage", "send gif image is not supported");
					MMMessageBox.Show(strings.ChatImgSendFormatError, true, "确定");
					return;
				}
			}
			if (MassSend.getInstance().mSceneMassSend.doSceneSendImg(this.listUserName, this.listCount, this.bIsSendAgain, imgStream, isNeedScale))
			{
				this.showProgressCover(strings.MassSend_WriteMessage_Sending);
				return;
			}
			MessageBoxManager.ShowToast(strings.ChatValidError, 2500, null, false);
		}
		private void SendChosenPhoto(Stream photoStream)
		{
			if (photoStream == null)
			{
				return;
			}
			byte[] array = new byte[100];
			photoStream.Read(array, 0, 100);
			ImageFromat imageFormat = ImageUtil.getImageFormat(array);
			photoStream.set_Position(0L);
			Log.smethod_5("SendMessagePage", "image format = " + imageFormat.ToString());
			if (imageFormat != ImageFromat.jpeg)
			{
				if (imageFormat != ImageFromat.const_2)
				{
					Log.smethod_1("SendMessagePage", "send gif image is not supported");
					MMMessageBox.Show(strings.ChatImgSendFormatError, true, "确定");
					return;
				}
			}
			if (MassSend.getInstance().mSceneMassSend.doSceneSendImg(this.listUserName, this.listCount, this.bIsSendAgain, photoStream, true))
			{
				this.showProgressCover(strings.MassSend_WriteMessage_Sending);
				return;
			}
			MessageBoxManager.ShowToast(strings.ChatValidError, 2500, null, false);
		}
		private void AutoMassSendImg(string strPicToken)
		{
			Log.smethod_5("SendMessagePage", "AutoSendImg " + strPicToken);
			MediaLibrary mediaLibrary = new MediaLibrary();
			Picture pictureFromToken = mediaLibrary.GetPictureFromToken(strPicToken);
			if (pictureFromToken != null)
			{
				this.SendChosenPhoto(pictureFromToken.GetImage());
			}
		}
		private string GetFileName(PhotoResult photoResult_0)
		{
			return Guid.NewGuid().ToString();
		}
		private void showProgressCover(string strCoverTitle)
		{
			if (!this.hasCoverInfront)
			{
				ProcessingCover.getProgressBar(this.LayoutRoot, strCoverTitle, null, false, false, null);
				this.hasCoverInfront = true;
			}
		}
		private void hideProgressCover()
		{
			if (this.hasCoverInfront)
			{
				ProcessingCover.releaseProgressBar(this.LayoutRoot);
				this.hasCoverInfront = false;
			}
		}
		private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
		{
			base.set_IsTabStop(true);
		}
		private void initInputer()
		{
			if (this.mBIsInputerInited)
			{
				return;
			}
			this.mBIsInputerInited = true;
			this.ExtraActionBtn = new RoundButton();
			this.ExtraActionBtn.Orientation = 1;
			RoundButton arg_45_0 = this.ExtraActionBtn;
			BitmapImage bitmapImage = new BitmapImage();
			bitmapImage.set_UriSource(new Uri("/Resource/Img/Chat/extra/add.png", 2));
			arg_45_0.ImageSource = bitmapImage;
			this.ExtraActionBtn.set_Content("");
			this.ExtraActionBtn.set_Width(60.0);
			this.ExtraActionBtn.set_Height(53.0);
			Control arg_9A_0 = this.ExtraActionBtn;
			SolidColorBrush solidColorBrush = new SolidColorBrush();
			solidColorBrush.set_Color(Colors.get_White());
			arg_9A_0.set_Foreground(solidColorBrush);
			Control arg_B7_0 = this.ExtraActionBtn;
			SolidColorBrush solidColorBrush2 = new SolidColorBrush();
			solidColorBrush2.set_Color(Colors.get_White());
			arg_B7_0.set_BorderBrush(solidColorBrush2);
			this.ExtraActionBtn.set_VerticalAlignment(2);
			this.ExtraActionBtn.set_HorizontalAlignment(1);
			this.ExtraActionBtn.add_ManipulationStarted(new EventHandler<ManipulationStartedEventArgs>(this.ExtraActionBtn_ManipulationStarted));
			this.ExtraActionBtn.add_ManipulationCompleted(new EventHandler<ManipulationCompletedEventArgs>(this.ExtraActionBtn_ManipulationCompleted));
			this.ExtraActionBtn.add_Click(new RoutedEventHandler(this.ExtraActionBtn_Click));
			this.ExtraActionBtn.set_Margin(new Thickness(0.0, 0.0, 5.0, 9.0));
			this.mExtralChatButton.contentStackPanel.set_Margin(new Thickness(0.0, 0.0, 6.0, 0.0));
			this.mExtralChatButton.triangleFlag.set_Margin(new Thickness(0.0, 0.0, 10.0, 12.0));
			this.mInputer.inputBk.get_Children().Insert(3, this.ExtraActionBtn);
			this.mInputer.UpdateLayout();
			this.FootArea.set_Visibility(0);
		}
		private object mInputer_mDlgBtnSendText(object sender, object object_0)
		{
			this.DoSend((string)object_0, false);
			this.SwitchMode(ChatInputMode.InputDefault, false);
			return null;
		}
		private void delegateGetContact(Contact mCon)
		{
			if (this.mInputer != null && this.mInputer.inputTxt.realBox != null)
			{
				this.mInputer.inputTxt.Focus();
				ChatInputTextBox expr_36 = this.mInputer.inputTxt;
				expr_36.Text = expr_36.Text + mCon.strNickName + " ";
			}
		}
		private object mInputer_mDlgInputAtMember(object sender, object object_0)
		{
			return null;
		}
		private object mInputer_mDlgOnEndPushPage(object sender, object object_0)
		{
			if (this.mIsDelaySendMsg)
			{
				this.FireSendTxt();
				this.mIsDelaySendMsg = false;
			}
			return null;
		}
		private object mInputer_mDlgOnInputerModeChange(object sender, object object_0)
		{
			ChatInputMode mode = (ChatInputMode)object_0;
			this.SwitchMode(mode, false);
			return null;
		}
		private object mInputer_mDlgOnRealBoxGotFocus(object sender, object object_0)
		{
			this.isInputFocus = true;
			return null;
		}
		private object mInputer_mDlgOnRealBoxLostFocus(object sender, object object_0)
		{
			this.isInputFocus = false;
			return null;
		}
		private object mInputer_mDlgOnStartPushPage(object sender, object object_0)
		{
			return null;
		}
		private object mInputer_mDlgVoiceInputStarted(object sender, object object_0)
		{
			base.get_Dispatcher().BeginInvoke(delegate
			{
				if (this.isVoiceRecordStart)
				{
					return;
				}
				this.isVoiceRecordStart = true;
				Log.smethod_5("SendMessagePage", "ServiceCenter.sceneUploadVoice.doSceneBegin");
				if (!MassSend.getInstance().mSceneMassSend.doSceneBeginSendVoice())
				{
					this.ShowVoiceError();
				}
			});
			return "HandleVoiceByParent";
		}
		private object mInputer_mDlgVoiceInputEnd(object sender, object object_0)
		{
			bool isCancelled = (bool)object_0;
			base.get_Dispatcher().BeginInvoke(delegate
			{
				if (!this.isVoiceRecordStart)
				{
					return;
				}
				this.isVoiceRecordStart = false;
				Log.smethod_5("SendMessagePage", "ServiceCenter.sceneUploadVoice.doSceneEnd");
				if (!MassSend.getInstance().mSceneMassSend.doSceneEndSendVoice(this.listUserName, this.listCount, this.bIsSendAgain, isCancelled))
				{
					Log.smethod_5("SendMessagePage", "ShowVoiceError");
					this.ShowVoiceError();
					return;
				}
				if (!isCancelled)
				{
					this.showProgressCover(strings.MassSend_WriteMessage_Sending);
				}
			});
			return null;
		}
		private void mExtralChatButton_ShareLocationButtonClick(object sender, RoutedEventArgs e)
		{
			this.DoShareLocationBtnEvent();
		}
		private void mExtralChatButton_ShareCardClick(object sender, RoutedEventArgs e)
		{
			this.DoShareCardBtnEvent();
		}
		private void mExtralChatButton_CameraCardClick(object sender, RoutedEventArgs e)
		{
			this.DoCameraBtnEvent();
		}
		private void mExtralChatButton_PicButtonClick(object sender, RoutedEventArgs e)
		{
			this.DoImgSendBtnEvent();
		}
		private void ExtraActionBtn_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
		{
			this.mBIsExtraActionCancled = false;
		}
		private void ExtraActionBtn_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
		{
			Log.smethod_5("SendMessagePage", "ExtraActionBtn_Click");
			if (this.mBIsExtraActionCancled)
			{
				return;
			}
			this.mBIsExtraActionCancled = true;
			this.mExtralChatButton.Switch();
			this.mExtralChatButton.Focus();
			this.mExtralChatButton.add_LostFocus(new RoutedEventHandler(this.mExtralChatButton_LostFocus));
		}
		private void ExtraActionBtn_Click(object sender, RoutedEventArgs e)
		{
			Log.smethod_5("SendMessagePage", "ExtraActionBtn_Click");
			if (this.mBIsExtraActionCancled)
			{
				return;
			}
			this.mBIsExtraActionCancled = true;
			this.mExtralChatButton.Switch();
			this.mExtralChatButton.Focus();
			this.mExtralChatButton.add_LostFocus(new RoutedEventHandler(this.mExtralChatButton_LostFocus));
		}
		private void mExtralChatButton_LostFocus(object sender, RoutedEventArgs e)
		{
			object focusedElement = FocusManager.GetFocusedElement();
			if (focusedElement != this.ExtraActionBtn && focusedElement != this.mExtralChatButton.CameraBtn && focusedElement != this.mExtralChatButton.ImgSendBtn && focusedElement != this.mExtralChatButton.ShareCardBtn)
			{
				this.mExtralChatButton.Hide();
			}
			this.mExtralChatButton.remove_LostFocus(new RoutedEventHandler(this.mExtralChatButton_LostFocus));
		}
		private void DoCameraBtnEvent()
		{
			this.mExtralChatButton.Hide();
			if (this.mCuInputMode == ChatInputMode.InputSmileyMode)
			{
				this.SwitchMode(ChatInputMode.InputDefault, false);
			}
			this.TakePhoto();
		}
		private void DoShareCardBtnEvent()
		{
			this.mExtralChatButton.Hide();
			MMMessageBox.Show(strings.MassSend_WriteMessage_NotSupport, true, "确定");
		}
		private void DoImgSendBtnEvent()
		{
			this.mExtralChatButton.Hide();
			base.Focus();
			if (this.mCuInputMode == ChatInputMode.InputSmileyMode)
			{
				this.SwitchMode(ChatInputMode.InputDefault, false);
			}
			this.ChooserPicture();
		}
		private void DoShareLocationBtnEvent()
		{
			this.mExtralChatButton.Hide();
			MMMessageBox.Show(strings.MessageContent_ShareLocatoin_NotSupported, true, "确定");
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/Plugin/MassSend/UI/SendMessagePage.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.MassSendTitle = (Grid)base.FindName("MassSendTitle");
			this.TitleArea = (StackPanel)base.FindName("TitleArea");
			this.PageTitle = (EmojiText)base.FindName("PageTitle");
			this.ChatPanelRoot = (Grid)base.FindName("ChatPanelRoot");
			this.ChatList = (Grid)base.FindName("ChatList");
			this.sendPeopleCtrl = (SendMsgViewCtrl)base.FindName("sendPeopleCtrl");
			this.FootArea = (StackPanel)base.FindName("FootArea");
			this.mInputer = (MMInputer)base.FindName("mInputer");
			this.mExtralChatButton = (ExtralChatButton)base.FindName("mExtralChatButton");
		}
	}
}
